<%@ page language="java" pageEncoding="GBK" %>
<%@ page contentType="text/html; charset=GBK" language="java"%>
<%@ page import="com.hd123.rumba.request.Dictionary"%>
<%@ page import="com.hd123.rumba.user.IUser"%>

<%@ page import="com.hd123.rumba.runtime.NamingMgr"%>
<%@ page import="com.hd123.rumba.user.CUser"%>
<%@ page import="com.hd123.rumba.user.biz.IBUserMgr"%>
<%
Dictionary dd = (Dictionary)request.getAttribute("dd");

String viewName = (String) dd.get("viewName");

IBUserMgr buserMgr = (IBUserMgr) NamingMgr.getInstance().lookupMgr(IBUserMgr.class);
%>

<script language=javascript>
function buildQuery(qry, codeLike) {
	qry.service = "<%=viewName%>.queryList";
	qry.addFrom("<%=buserMgr.getPerzMgr().lookupClass(IUser.class)%>", "u");
	qry.addSelect("u.uuid", "uuid");
	qry.addSelect("u.login", "login");
	qry.addSelect("u.name", "name");
	var where = new RSCE();
	where.operator = RSCE.VALUE_OPERATOR_AND;
	where.append(RSCE.cond("u.state <> ?", <%=String.valueOf(CUser.VALUE_STATE_DELETED)%>));
	if (isDefined(codeLike) && trimString(codeLike) != "")
		where.append(RSCE.cond("u.login like ?", codeLike, RSCE.WC_RIGHT));
	qry.setWhere(where);
	qry.addOrder("u.login", RQuery.ORDER_ASC);
}

function buildGrid(grid) {
	grid.addColumnDef(new RQColumnDef({caption: "uuid", 
		fieldName: "uuid", dataType: RQColumnDef.DT_TEXT, hidden: true}));
	grid.addColumnDef(new RQColumnDef({caption: "<%=CUser.CAPTION_LOGIN%>", 
		fieldName: "login", dataType: RQColumnDef.DT_TEXT}));
	grid.addColumnDef(new RQColumnDef({caption: "<%=CUser.CAPTION_NAME%>", 
		fieldName: "name", dataType: RQColumnDef.DT_TEXT}));
}
</script>